
package com.rf.richfitwheel.workflow.entity;

import com.rf.richfitwheel.admin.sys.vo.UserVO;
import lombok.Data;

import java.util.HashMap;
import java.util.Map;

@Data
public class WfTaskParam {
    private String processKey;//流程主键
    private String approveNo;//审批编号
    private String orgCode;//企业编码
    private String processCode;//流程代码
    private String taskId;//任务id
    private String fileId;//任务id
    private String businessKey;//业务主键
    private String moduleType;//模块类型
    private String queueName;//消息队列名称
    private String processInstanceId;//流程实例id
    private String approveUserId;//审批用户id
    private String approveMessage;//审批意见
    private String approveAdvice;//审批结果
    private String submitToPrev = "n";//y按顺序提交,y提交至退回节点 //退回后的流程再次提交直接到上一次的退回人那里
    private String finishProcess = "n";//n流程主动结束
    private boolean isSkipFirstTask = false;//是否跳过第一个任务(经办人完成)
    private UserVO userVO;
    private Map<String, Object> variables = new HashMap();//流程参数
    private Map<String, Object> variablesLocal = new HashMap();//任务参数
    private Map<String, Object> authRules = new HashMap();//授权规则
    private String processInsName;//流程摘要，流程发起时传入
    /**
     * 业务功能设计ID
     */
    private String businessDesignerId;
    /**
     * 业务功能设计编码
     */
    private String businessDesignerCode;
    /**
     * 密级 必传 由发起人决定的
     */
    private Integer secretLevel;
    public WfTaskParam() {
    }

    public Map<String, Object> getBaseParam(UserVO user) {
        Map<String, Object> variables = this.getVariables();//组装task参数
        variables.put("businessKey", this.businessKey);//流程主键
        variables.put("approveNo", this.approveNo);//审批编号
        variables.put("orgCode", this.orgCode);//企业编码
        variables.put("processCode", this.processCode);//流程代码
        variables.put("moduleType", this.moduleType);//模块类型
        variables.put("queueName", this.queueName);//消息队列名称
        variables.put("startUserId", user.getId());//发起人Id
        variables.put("startUserName", user.getStaffName());//发起人姓名,姓名不是用户名
        //variables.put("approveAdvice", this.approveAdvice);//true流程主动结束
        variables.put("finishProcess", this.finishProcess);//true流程主动结束
        variables.put("submitToPrev", this.submitToPrev);//是否按顺序提交
        //variables.put("taskState", WorkflowContants.ProcessResult.CREATE.getValue());//流程正常流转状态
        return variables;
    }

}
